package com.compound;

public class DuckSimulator4 {
	public static void main(String[] args) {
		DuckSimulator4 simulator4 = new DuckSimulator4();
		AbstractDuckFactory duckFactory = new CountingDuckFactory();
		simulator4.simulate(duckFactory);
	}

	void simulate(AbstractDuckFactory duckFactory) {
		Quackable mallardDuck = duckFactory.createMallardDuck();
		Quackable redheadDuck = duckFactory.createRedheadDuck();
		Quackable duckCall = duckFactory.createDuckCall();
		Quackable rubberDuck = duckFactory.createRubberDuck();

		// Goose Adapter
		// Take the goose as a duck
		Quackable gooseDuck = new GooseAdapter(new Goose());

		System.out.println("\nDuck Simulator");

		simulate(mallardDuck);
		simulate(redheadDuck);
		simulate(duckCall);
		simulate(rubberDuck);
		simulate(gooseDuck);

		System.out.println("The ducks quacked " + QuackCounter.getQuacks()
				+ " times");
	}

	void simulate(Quackable duck) {
		duck.quack();
	}
}
